package top.malaoshi.webmvc.parameter;

import top.malaoshi.webmvc.info.MethodsArgumentInfo;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class StringResolver extends AbstractResolver implements RequestParamAndMethodArgsResolver {
    @Override
    public Object resolver(HttpServletRequest request,
                           HttpServletResponse response ,
                           MethodsArgumentInfo mai) {

        checkNameAndValue(mai);
        String parameterName = getName(mai);
        String ret = request.getParameter(parameterName);
        checkRequired(ret,mai);
        return ret;
    }
}
